package com.yxy.feign;

import com.yxy.base.RestResponse;
import com.yxy.feign.DTO.*;
import com.yxy.feign.VO.TenantExtend2;
import com.yxy.feign.VO.UserExtend;
import com.yxy.feign.authModel.AppDataDicDetail;
import com.yxy.feign.authModel.Tenant;
import com.yxy.utils.PageDataList;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@Service
//@FeignClient(name = "union-auth") //url = "localhost:32008"
@FeignClient(name = "union-auth", url = "${unionAuthUrl}")
public interface AuthService {
  /**获取app的租户列表**/
  @RequestMapping(value = "/tenant/list", method = RequestMethod.POST)
  RestResponse<PageDataList<TenantExtend2>> getTenantList(@RequestBody TenantListDto inputDto);

  /**创建or修改tenant,返回tenant id**/
  @RequestMapping(value = "/tenant/createOrUpdate2", method = RequestMethod.POST)
  RestResponse createOrUpdate2Tenant(@RequestBody TenantCreateDto2 inputDto,
                             @RequestParam("invoke_union_auth_token") String invoke_union_auth_token);

  /**获取app的用户列表**/
  @RequestMapping(value = "/app-user/list", method = RequestMethod.POST)
  RestResponse<PageDataList<UserExtend>> getUserList(@RequestBody UserListDto inputDto);

  /**获取单个租户详情**/
  @RequestMapping(value = "/tenant/getTenantById", method = RequestMethod.GET)
  RestResponse<Tenant> getTenantById(@RequestParam("id") long id);

  /**根据主键id获取单个字典项详情**/
  @RequestMapping(value = "/data-dic/getDataDicDetailById", method = RequestMethod.GET)
  RestResponse<AppDataDicDetail> getDataDicDetailById(@RequestParam("id") long id,
                                                      @RequestParam("invoke_union_auth_token") String invoke_union_auth_token);

  /**根据字典具体项的value获取单个字典项详情**/
  @RequestMapping(value = "/data-dic/getDataDicDetailByValue", method = RequestMethod.GET)
  RestResponse<AppDataDicDetail> getDataDicDetailByValue(@RequestParam("appCode") String appCode,
                                                         @RequestParam("value") String value,
                                                      @RequestParam("invoke_union_auth_token") String invoke_union_auth_token);

  /**获取app系统参数值**/
  @RequestMapping(value = "/app-system-setting/getParamValue", method = RequestMethod.POST)
  RestResponse<String> getParamValue(@RequestBody GetParamValueQueryDTO inputDto,
                                                      @RequestParam("invoke_union_auth_token") String invoke_union_auth_token);

  /**创建or修改app登录用户**/
  @RequestMapping(value = "/app-user/createOrUpdate2", method = RequestMethod.POST)
  RestResponse createOrUpdateAppUser(@RequestBody AppUserCreateDto2 inputDto,
                                     @RequestParam("invoke_union_auth_token") String invoke_union_auth_token);

  /**删除app登录用户**/
  @RequestMapping(value = "/app-user/deleteFromApp", method = RequestMethod.GET)
  RestResponse deleteAppUser(@RequestParam("id") long id,
                                     @RequestParam("invoke_union_auth_token") String invoke_union_auth_token);
}
